//
// Created by codex on 2024/5/29.
//

#ifndef ACE_PERIPHERAL_H
#define ACE_PERIPHERAL_H

#include "main.h"

#define ACE_TYPE                0xFF

#define CMD_TYPE                0x10
#define BEEP_TYPE               0xF1
#define LASER_TYPE              0xF2
#define MOTOR_TYPE              0xF3
#define CAMERA_TYPE             0xE0
#define LED_TYPE                0xF5
#define SERVO_TYPE              0xF7
#define IR_TYPE                 0xE1
//E2为转发串口屏数据
#define PER_STATE_TYPE          0xE3

#define ON                      0xA1
#define OFF                     0xA0

#define TURN_RED                0x01
#define TURN_GREEN              0x02
#define TURN_BLUE               0x03
#define TURN_BLACK              0x04
#define TURN_WHITE              0x05

#define RELEASE_ZERO            0x20
#define RELEASE_ONE             0x21
#define RELEASE_TWO             0x22
#define RELEASE_THREE           0x23
typedef struct {
    //led
    uint8_t LED_RED_STA;
    uint8_t LED_GREEN_STA;
    uint8_t LED_BLUE_STA;
    uint8_t LED_WHITE_STA;
    //舵机
    uint8_t MOTOR_1_STA;
    uint8_t MOTOR_2_STA;
    uint8_t MOTOR_3_STA;
    uint8_t MOTOR_4_STA;
    //蜂鸣器
    uint8_t BEEP_STA;
    uint8_t BEEP_FLAG;
    //按钮
    uint8_t BUTTON1_STA;
    uint8_t BUTTON2_STA;
    //激光头
    uint8_t LASER_STA;
    //摄像头
    uint8_t CAMERA_MODE;
    uint8_t SERVO_STA;
}PERI;
union FloatData {
    float fValue;     // 浮点数
    uint8_t u8Value[4];  // 用于确保对齐的32位整数
};
void myPERI_init();
void Mix_Send_Data_2Up(uint8_t frame_num);
void Mix_Send_Data_2Camera(uint8_t frame_num);
void UpperComputer_DataAnl(uint8_t *data);
#endif //ACE_PERIPHERAL_H
